<template>
  <div class="base-container">
    <t-tabs  v-model="tabValue">
      <t-tab-panel  v-for="(tab, tabIndex) in tabList" :key="tabIndex" :value="tab.value" >
        <template #label>
          {{tab.label}}<t-badge style="position: relative" :count="tab.count" show-zero :offset="[-6, 0]"></t-badge>
        </template>
        <div v-if="tab.value === '0'">
          <kjxm-review-group-opinion-my-list></kjxm-review-group-opinion-my-list>
        </div>
        <div v-if="tab.value === '1'">
          <bzh-review-group-opinion-my-list></bzh-review-group-opinion-my-list>
        </div>
        <div v-if="tab.value === '2'">
          <kjsf-review-group-opinion-my-list></kjsf-review-group-opinion-my-list>
        </div>
      </t-tab-panel>
    </t-tabs>
  </div>
</template>

<script>
import bzhReviewGroupOpinionMyList from "./components/bzh-review-group-opinion-my-list.vue";
import kjxmReviewGroupOpinionMyList from "./components/kjxm-review-group-opinion-my-list.vue";
import kjsfReviewGroupOpinionMyList from "./components/kjsf-review-group-opinion-my-list.vue";

export default {
  name: "review-group-opinion",
  components:{
    bzhReviewGroupOpinionMyList,
    kjxmReviewGroupOpinionMyList,
    kjsfReviewGroupOpinionMyList
  },
  data(){
    return {
      tabValue: '0',
      site_tag: import.meta.env.VITE_SITE_TAG,
      tabList: [
        { label: '科技项目', value: '0', count: 0 },
        // { label: '标准化', value: '1', count: 0 },
        // { label: '示范工程', value: '2', count: 0 },
      ],
    }
  },
  created(){
    this.tabValue = this.$route.query.tabValue || '0';
    this.getList();
    if(this.site_tag === 'jtt'){
      this.getBzh();
      this.tabList.push({ label: '标准化', value: '1', count: 0 })
      this.getKjsf();
      this.tabList.push({ label: '示范工程', value: '2', count: 0 })
    }
  },
  methods:{
    getList(){
      this.dataLoading = true;
      this.$api.kjxm.review.teamLeaderMyReviewList(this.queryParams).then(response => {
        this.tabList[0].count = response.total;
      }).catch((e) => {
        this.dataLoading = false;
        this.$message.error(e.toString());
      });
    },
    getBzhList(){
      this.dataLoading = true;
      this.$api.bzh.review.teamLeaderMyReviewList(this.queryParams).then(response => {
        this.tabList[1].count = response.total;
      }).catch((e) => {
        this.dataLoading = false;
        this.$message.error(e.toString());
      });
    },
    getKjsfList(){
      this.$api.kjsf.review.teamLeaderMyReviewList(this.queryParams).then(response => {
        this.tabList[2].count = response.total;
      }).catch((e) => {
        this.$message.error(e.toString());
      });
    },
  }
}
</script>

<style lang="less" scoped>
/deep/ .t-badge--circle{
  position: relative;
}
</style>
